Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
Why i get error "unreachable code" when i try to put an if in my function?

When i insert "if (descriptions >= 0.4){zien()} then it gets red underlined with error "unreachable code". Why is that??

function loadLabeledImages() {
  const labels = ['Simon', 'Thomas'];
  return Promise.all(
    labels.map(async (label) => {
      const img = await faceapi.fetchImage(`./images/${label}.jpg`);
      const detections = await faceapi
      .detectSingleFace(img)
      .withFaceLandmarks()
      .withFaceDescriptor();
      const descriptions = [detections.descriptor];
      return new faceapi.LabeledFaceDescriptors(label, descriptions);

      if (descriptions >= 0.4){
        zien()
      }
    }),

  );

}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The fact is it an if is irrelevant. It is code that appears after a return statement.

When running the function, the JS engine will always return from the function before reaching the if. Since it can never reach the if, the if is unreachable.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda